{include file="public/header" /}



<div class="page">
    <div class="fixed-bar">
        <div class="item-title">
            <div class="subject">
                <h3>答案管理</h3>
                <h5></h5>
            </div>
            {include file="public/admin_items" /}
        </div>
    </div>
    <div class="fixed-empty"></div>
    <div class="explanation" id="explanation">
        <div class="title" id="checkZoom">
            <h4 title="{$Think.lang.ds_explanation_tip}">{$Think.lang.ds_explanation}</h4>
            <span id="explanationZoom" title="{$Think.lang.ds_explanation_close}" class="arrow"></span>
        </div>
    </div>
    <form method="get" name="formSearch" id="formSearch">
        <div class="ds-search-form">
            <dl>
                <dt>描述</dt>
                <dd><input type="text" value="{$Request.param.search_content}" name="search_content" class="txt"></dd>
                <dd><input type="submit" class="btn btn-small" value="{$Think.lang.ds_search}"></dd>
            </dl>

            <div class="btn_group">
<!--                <input type="submit" class="btn" value="{$Think.lang.ds_search}">-->
            </div>
        </div>
    </form>
    <div class="ds-search-form">
        <button class="btn btn-small" onclick="dsLayerOpen('{:url('Answer/add',['id'=>0])}','{$Think.lang.ds_add}-{$Think.lang.question_add}')">新增</button>

    </div>
    <table class="ds-default-table">
        <thead>
        <tr class="thead">
            <th class="w48"></th>
            <th class="w48">{$Think.lang.ds_sort}</th>
            <th>{$Think.lang.answer_index_name}</th>
            <th>现象</th>
            <th class="w120 align-center">{$Think.lang.ds_handle}</th>
        </tr>
        <tbody>
        {notempty name="answer_list"}
        {foreach name="answer_list" item="answer"}
        <tr id="ds_row_{$answer.id}">
            <td>{$answer.id}</td>
            <td>{$answer.order}</td>
            <td>{$answer.content}</td>
            <td>

                {$answer->option->content | default="未关联（可选择删除）"}

            </td>
            <td>
                <a href="javascript:dsLayerOpen('{:url('Answer/edit',['answer_id'=>$answer.id])}','编辑')" class="dsui-btn-edit"><i class="iconfont"></i>{$Think.lang.ds_edit}</a>
<!--                <a href="javascript:dsLayerOpen('{:url('Answer/addMethod',['id'=>$answer.id])}','管理方法')" class="dsui-btn-edit"><i class="iconfont"></i>处理办法</a>-->
                <a href="javascript:void(0);" onclick="submit_delete('{$answer.id}')"  class="dsui-btn-del"><i class="iconfont"></i>{$Think.lang.ds_del}</a>
            </td>
        </tr>
        {/foreach}
        {else /}
        <tr class="no_data">
            <td colspan="10">{$Think.lang.ds_no_record}</td>
        </tr>
        {/notempty}
        </thead>
    </table>
    {$show_page}
</div>
<script src="{$Think.ADMIN_SITE_ROOT}/js/question.js"></script>
<script type="text/javascript" src="{$Think.ADMIN_SITE_ROOT}/js/jquery.edit.js" charset="utf-8"></script>
<script type="text/javascript">
    function submit_delete(id){
        layer.confirm('确定要删除该答案吗，如有关联处理办法会一并删除', {
            btn: ['确定', '取消'],
            title: false,
        }, function () {
            var _uri = ADMINSITEURL+"/Answer/delete.html?id=" + id;
            $.get(_uri, function (data) {
                data = JSON.parse( data );
                console.log(data)
                layer.msg(data.message, {time: 1000}, function () {
                    if (data.code == 10000) {
                        $("#ds_row_"+id).remove();
                    }
                })
            }, 'json')
        })

    }
</script>
